﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOCDI.Factory
{
    /// <summary>
    /// 固定读取根目录下面的appsettings.json
    /// </summary>
    public static class ConfigurationManager
    {
        private static IConfigurationRoot _iConfiguraiton;

        static ConfigurationManager()
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

            _iConfiguraiton = builder.Build();
        }


        public static string GetNode(string nodeName)
        {
            return _iConfiguraiton[nodeName];
        }

    }
}
